/**
 * 
 */
package org.lookouster.mopg.bo;

import java.sql.SQLException;

import org.lookouster.mopg.connector.Database;

/**
 * @author lkster
 *
 */
public class ServiceProvider {
	
	int providerId;
	String providerName;
	
	public ServiceProvider(int id)
	{
		providerId = id;
		try {
			providerName = Database.retrieveData("select provider_name from service_provider where id = '" + id + "'").getString("provider_name");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			providerName = null;
		}
	}
	
	public ServiceProvider(String name)
	{
		providerName = name;
		try {
			providerId = Database.retrieveData("select id from service_provider where provider_name like '" + name + "' ").getInt("id");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			providerId = 0;
		}
	}
	
	public int getProviderId()
	{
		return providerId;
	}
	
	public String getProviderName()
	{
		return providerName;
	}
	

}
